//
//  ForumTableViewCell.m
//  BaseProject
//
//  Created by hundredsandc on 2017/10/28.
//  Copyright © 2017年 hundredsandc. All rights reserved.
//

#import "ForumTableViewCell.h"
//#import "AllCommentVC.h"
#import "UIView+Addtions.h"
#import "UIView+Addtions.h"
#import "ForumVC.h"
//#import "loginVC.h"

@interface ForumTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *likeLabel;

@property (weak, nonatomic) IBOutlet UILabel *commentLabel;


@end
@implementation ForumTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _nameLabel.layer.cornerRadius = 2.0;
    _nameLabel.layer.masksToBounds = YES;
  
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)customTitle:(NSString *)title userName:(NSString *)userName likeCount:(NSInteger)likeCount commentCount:(NSInteger)commentCount{
    _nameLabel.text = userName;
    _titleLabel.text = title;
    _likeLabel.text = [NSString stringWithFormat:@"%ld 喜欢",likeCount];
    _commentLabel.text = [NSString stringWithFormat:@"%ld 回复",commentCount];
}
- (IBAction)commentBtnClick:(id)sender {
//    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//    NSString *islogined = [defaults objectForKey:CurrentUser];
//    if (islogined.length>0) {
//        AllCommentVC *all = [AllCommentVC new];
//        all.model = self.model;
//        [self.viewController.navigationController pushViewController:all animated:YES];
//    }else{
//        loginVC *vc = [loginVC new];
//        [self.viewController.navigationController pushViewController:vc animated:YES];
//        
//    }
    
}
- (IBAction)likeBtnClick:(id)sender {
//    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//    NSString *islogined = [defaults objectForKey:CurrentUser];
//    if (islogined.length>0) {
//
//        [self likeClick];
//    }else{
//        loginVC *vc = [loginVC new];
//        [self.viewController.navigationController pushViewController:vc animated:YES];
//        
//    }
}
-(void)likeClick{
//    NSMutableDictionary *params = [NSMutableDictionary dictionary];
//    params[@"tid"] = @(self.tid);
//    [HTTPManagers postLikeWithURL:@"like" params:params success:^(id json) {
//        if ([json[@"message"]isEqualToString:@"unrepeatable like"]) {
//            [SVProgressHUD showErrorWithStatus:@"您已点过赞～" maskType:SVProgressHUDMaskTypeBlack];
//            [_likeBtn setBackgroundImage:[UIImage imageNamed:@"xingxing_dianji"] forState:UIControlStateNormal];
//            _likeBtn.userInteractionEnabled = NO;
//            ForumViewController *vc = (ForumViewController *)self.viewController;
//            [vc.tableView reloadData];
//            return ;
//        }
//        if ([json[@"code"]integerValue]==1) {
//            [SVProgressHUD showErrorWithStatus:@"请重新登陆" maskType:SVProgressHUDMaskTypeBlack];
//        }else{
//            [_likeBtn setBackgroundImage:[UIImage imageNamed:@"xingxing_dianji"] forState:UIControlStateNormal];
//            _likeBtn.userInteractionEnabled = NO;
//            
//        ForumViewController *vc = (ForumViewController *)self.viewController;
//            [vc getForumData];
//        }
//    } failure:^(NSError *error) {
//        
//    }];
    
}

@end
